package com.itheima.response;



import java.io.Serializable;

/**
 * 封装返回结果
 */

public class Result<T> implements Serializable{
    private boolean flag;//执行结果，true为执行成功 false为执行失败
    private String message;//返回结果信息
    private Object data;//返回数据

    /*
    * 响应失败
    * */
    public Result( String message) {
        this.flag = false;
        this.message = message;
    }
    /*
    * 响应成功
    * */
    public Result( Object data) {
        this.flag = true;
        this.message = "执行成功";
        this.data = data;
    }

    public Result(boolean flag, String message, Object data) {
        this.flag = flag;
        this.message = message;
        this.data = data;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
